package J17;

import java.util.Scanner;

public class J17_ProductMain {
	
	private static String title = "배열을 이용한 상품 등록 프로그램";
	private static String menu = "(1)추가    (2)조회     (3)종료";
	private static String addmsg = "번호, 이름, 설명, 제조사, 가격순으로 입력";
	private static String exitmsg = "프로그램을 종료 합니다.";
	
	public static void main(String[] args) {
		J17_Product psrv = new J17_Product();
		Scanner sc = new Scanner(System.in);
	
	System.out.println(title);
	while (true){
		System.out.println(menu);
		switch(sc.nextInt()){
		case 1: addProduct(sc, psrv);
			break;
			
		case 2: showProduct(psrv);
			break;
		case 3: sc.close() ;
			System.out.println(exitmsg);
			System.exit(3);
			break;
		
		}
		
		
	}
	
	}

	private static void addProduct(Scanner sc, J17_Product psrv) {
		System.out.println(addmsg);
		J17_ProductVO pvo = new J17_ProductVO(sc.next(),sc.next(),sc.next(),sc.next(),sc.nextInt());
		psrv.addProduct(pvo);
	}
	private static void showProduct(J17_Product psrv) {
		System.out.println(psrv.readProduct());
	}

}
